#coding=utf-8
#Boa:FramePanel:PanelSaleListTemp

import wx

from MyListCtrl import MyListCtrlSaleOrderTemp,MyListCtrlSaleOrderDetailTemp

[wxID_PANELSALELISTTEMP] = [wx.NewId() for _init_ctrls in range(1)]

class PanelSaleListTemp(wx.Panel):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Panel.__init__(self, id=wxID_PANELSALELISTTEMP,
              name=u'PanelSaleListTemp', parent=prnt, pos=wx.Point(22, 29),
              size=wx.Size(200, 100), style=wx.TAB_TRAVERSAL)
        self.SetClientSize(wx.Size(192, 66))
        self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False, u'Arial'))
        self.SetBackgroundColour(wx.Colour(183, 209, 173))

    def __init__(self, parent):
        self._init_ctrls(parent)

        self.lcBill = MyListCtrlSaleOrderTemp(self)
        self.lcBill.SetSize(wx.Size(850, 300))
        self.lcBill.Move(wx.Point(10,38))
        self.lcBill.refresh() # 错写作Refresh，导致调试N久...避免类似函数名
        self.lcBill.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnBillListItemSelected)
        
        self.lcContent = MyListCtrlSaleOrderDetailTemp(self)
        self.lcContent.Move(wx.Point(10,345))
        self.lcContent.SetSize(wx.Size(850, 250))
        
    def OnBillListItemSelected(self, event):
        '''按照选中订单，显示订单内容'''
        item = self.lcBill.GetNextItem(-1, state = wx.LIST_STATE_SELECTED)
        #orderId = self.orderList.GetItem(item, self.orderList.COL_ID).GetText()
        billId = self.lcBill.getBillId(item)
        self.lcContent.refresh({'billId':billId})